#include<iostream>
using namespace std;
int n,x,y,r[100010];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>r[i];
        if(r[i]==1) x++;
        else y++;
    }
    if(y<x) cout<<n-y;
    else cout<<y;
    return 0;
}
